﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Atentis_Connector
{
	/// <summary>Свеча</summary>
	public class Candle
	{
		#region Свойства

		private double m_High;
		/// <summary>
		/// Максимальная цена
		/// </summary>
		public double High { get { return m_High; } set { m_High = value; } }

		private double m_Low;
		/// <summary>
		/// Минимальная цена
		/// </summary>
		public double Low { get { return m_Low; } set { m_Low = value; } }

		private double m_Open;
		/// <summary>
		/// Цена открытия
		/// </summary>
		public double Open { get { return m_Open; } set { m_Open = value; } }

		private double m_Close;
		/// <summary>
		/// Цена закрытия
		/// </summary>
		public double Close { get { return m_Close; } set { m_Close = value; } }

		private double m_Volume;
		/// <summary>
		/// Объем свечи
		/// </summary>
		public double Volume { get { return m_Volume; } set { m_Volume = value; } }

		private DateTime m_Date;
		/// <summary>
		/// Время
		/// </summary>
		public DateTime Date { get { return m_Date; } set { m_Date = value; } }

		private int m_Period;
		/// <summary>
		/// Период
		/// </summary>
		public int Period { get { return m_Period; } set { m_Period = value; } }

		private string m_Ticker;
		/// <summary>
		/// Описание
		/// </summary>
		public string Ticker { get { return m_Ticker; } set { m_Ticker = value; } }

		private double m_Mid;
		/// <summary>
		/// Среднее значение по свече
		/// </summary>
		public double Mid { get { return m_Mid; } set { m_Mid = value; } }

		#endregion Свойства

		#region Конструкторы
		/// <summary>
		/// Конструктор свечи
		/// </summary>
		public Candle()
		{
			High = 0;
			Low = 0;
			Open = 0;
			Close = 0;
			Volume = 0;
			Period = 0;
			Ticker = "Не инициализированная свечка";
			Date = DateTime.MinValue;
		}

		/// <summary>
		/// Конструктор свечи
		/// </summary>
		/// <param name="date">Время</param>
		/// <param name="ticker">Описатель</param>
		/// <param name="open">Цена открытия</param>
		/// <param name="high">Максимальная цена</param>
		/// <param name="low">Минимальная цена</param>
		/// <param name="close">Цена закрытия</param>
		/// <param name="close">Средняя цена</param>
		/// <param name="volume">Объем свечи</param>
		/// <param name="period">Период</param>
		public Candle(DateTime date, string ticker, double open, double high, double low, double close, double mid, double volume, int period)
		{
			Ticker = ticker;
			if (high == 0) { high = open; }
			if (low == 0) { low = open; }
			if (close == 0) { close = open; }
			Open = open;
			High = high;
			Low = low;
			Close = close;
			Mid = mid;
			Volume = volume;
			Period = period;
			Date = date;
		}
		/// <summary>
		/// Конструктор свечи
		/// </summary>
		/// <param name="date">Время</param>
		/// <param name="ticker">Описатель</param>
		/// <param name="open">Цена открытия</param>
		/// <param name="volume">Объем свечи</param>
		/// <param name="period">Период</param>
		public Candle(DateTime date, string ticker, double open, double volume, int period)
		{
			Ticker = ticker;
			Open = open;
			High = open;
			Low = open;
			Close = open;
			Volume = volume;
			Period = period;
			Date = date;
		}

		#endregion Конструкторы

	}
}
